'''
Created on Dec 11, 2012

@author: david
'''
from .wallData import *
from .playerData import *

class BoardNode(object):
    __slots__ = ('loc', 'neighbors', 'player')
    
    def __init__(self,loc,player):
        self.loc = loc
        self.player = player
        self.neighbors= []
        self.populateNeighbors()
        pass
        
    def __str__(self):
        return str(self.loc)
    
    def __repr__(self):
        return self.__str__()
    
    def populateNeighbors(self):
        r = self.loc[0]
        c = self.loc[1]
        if(r-1>=0):
            self.neighbors.append([r-1,c])
        if(c-1>=0):
            self.neighbors.append([r,c-1])
        if(r+1<9):            
            self.neighbors.append([r+1,c])
        if(c+1<9):
            self.neighbors.append([r,c+1])
    
    def getNeighbors(self):
        return self.neighbors